<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>设置错误处理函数</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="yaf-dispatcher.setdefaultmodule.html">« Yaf_Dispatcher::setDefaultModule</a></li>
      <li style="float: right;"><a href="yaf-dispatcher.setrequest.html">Yaf_Dispatcher::setRequest »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.yaf-dispatcher.html">Yaf_Dispatcher</a></li>
    <li>设置错误处理函数</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="yaf-dispatcher.seterrorhandler" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Yaf_Dispatcher::setErrorHandler</h1>
  <p class="verinfo">(Yaf &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_Dispatcher::setErrorHandler</span> &mdash; <span class="dc-title">设置错误处理函数</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yaf-dispatcher.seterrorhandler-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Yaf_Dispatcher::setErrorHandler</strong></span>(<span class="methodparam"><span class="type"><span class="type call">call</span></span> <code class="parameter">$callback</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$error_types</code></span>): <span class="type"><a href="class.yaf-dispatcher.html" class="type Yaf_Dispatcher">Yaf_Dispatcher</a></span></div>

  <p class="para rdfs-comment">
    设置错误处理函数，一般在<a href="yaf.appconfig.html#configuration.yaf.dispatcher.throwexception" class="link">application.dispatcher.throwException</a>关闭的情况下，Yaf会在出错的时候触发错误，这个时候，如果设置了错误处理函数，则会把控制交给错误处理函数处理。
  </p>
  <p class="para">
   因此，当错误发生的时候这个错误处理函数将被调用。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-yaf-dispatcher.seterrorhandler-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">callback</code></dt>

    <dd>

     <p class="para">
      错误处理的回调函数
     </p>
    </dd>

   
   
    <dt>
<code class="parameter">error_types</code></dt>

    <dd>

     <p class="para">
      
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-yaf-dispatcher.seterrorhandler-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">

  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-yaf-dispatcher.seterrorhandler-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="methodname"><a href="yaf-dispatcher.throwexception.html" class="methodname" rel="rdfs-seeAlso">Yaf_Dispatcher::throwException()</a> - 开启/关闭异常抛出</span></li>
   <li class="member"><span class="methodname"><a href="yaf-application.getlasterrorno.html" class="methodname" rel="rdfs-seeAlso">Yaf_Application::getLastErrorNo()</a> - 获取最后产生的错误的错误代码</span></li>
   <li class="member"><span class="methodname"><a href="yaf-application.getlasterrormsg.html" class="methodname" rel="rdfs-seeAlso">Yaf_Application::getLastErrorMsg()</a> - 获取最近产生的错误的错误信息</span></li>
  </ul>
 </div>


</div></div></div></body></html>